package tools.old.files;

import java.awt.Component;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;

import dao.DataConnection;
import account.model.Account;
import account.model.SubTeam;
import account.model.Student;
import account.student.view.StudentAccountView;
import account.view.InloggenView;
import tools.MD5;


public class DataLayerKlassen extends DataConnection {

	public ArrayList<Klas> loadKlassen(){
		ArrayList<Klas> klassen = new ArrayList<Klas>();
		Klas kl;

		String sql = "select * from klassen";

		kl = new Klas();
		kl.setKlas_id(0);
		kl.setKlas_naam("(Selecteer)"); //standaard tekst weergeven in dropdown (combobox)
		klassen.add(kl);

		try{
			openConn();
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql); 		

			while(rs.next()){
				kl = new Klas();
				kl.setKlas_id(rs.getInt("klas_id"));
				kl.setKlas_naam(rs.getString("klas_naam"));
				klassen.add(kl);			
			}			
		}
		catch(SQLException sqle){
			sqle.printStackTrace();
		}
		return klassen;
	}
}